#ifndef __SIPGD_SERVICE_HPP__
#define __SIPGD_SERVICE_HPP__

#include "WTResipDll/SipWTResipDllItf.hpp"
#include "WTSXSipService/SipWTSXServiceItf.hpp"
#include "WTSXSipService/SipSessionMgr.hpp"

namespace wtsxsip{


class WTSX_SIPSRV_PUBLIC CSipSXService: public ISipSXService, public wtsip::ISipUserAgentListener
{
public:

    CSipSXService();

    virtual ~CSipSXService();

    virtual bool init(const wtsip::SUri& localInfo, const ETransport transport);

    virtual bool start();

    virtual bool stop();

    virtual bool registerServiceListener(ISipSXServiceListener* listener);

    virtual bool unregisterServiceListener();

    virtual const wtsip::SUri& getLocalInfo();

    ////////////////////  B2B Sessions  ///////////////////////////////

    /*CSipTranB2bSession* buildTranB2bSession(CSipTranSession& caller, CSipTranSession& callee);

    CSipInvB2bSession* buildInvB2bSession(CSipInviteSession& caller, CSipInviteSession& callee);

    CSipSubB2bSession* buildSubB2bSession(CSipSubscribeSession2& caller, CSipSubscribeSession2& callee);*/

    ////////////////// creating methods ////////////////

    virtual ISipTranSession* createTranSession(const wtsip::SUri& tar, const wtsip::SUri& local, 
        const wtsip::SUri& remote, const wtsip::EMethodTypes mth);
    
    virtual ISipDlgSessionBase* createDlgSession(const wtsip::SUri& tar, const wtsip::SUri& local, 
        const wtsip::SUri& remote, const ISipDlgSessionBase::EDlgType type);

protected:

    ////////////////   CSipUserAgentListener method /////////////////////////

    virtual bool onRequest(wtsip::ISipDialogBase& dlg, wtsip::ISipSrvTransaction& srv, wtsip::CapSipMessage msg);

    virtual bool onRequest(wtsip::ISipSrvTransaction& srv, wtsip::CapSipMessage msg);

private:

    wtsip::CSipUserAgent* m_ua;

    wtsip::SUri m_localInfo;

    CSipSessionMgr m_sessionMgr;

    ISipSXServiceListener* m_ServiceListener;
};


}//namespase 

#endif


